﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using WeatherWS;

namespace WeatherWS
{
    /// <summary>
    /// Summary description for WeatherWS
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WeatherWS : System.Web.Services.WebService
    {

        [WebMethod(Description="Gets cities from xml file")]
        public List<City> GetCities()
        {
            string filename = Server.MapPath(Properties.Resources.xfnCity);
            return City.GetCities(filename);
        }

        [WebMethod(Description = "Gets weather informations from rss")]
        public List<Item> GetWeatherInformations(string locCode)
        {
            string rssUrl = Properties.Resources.rssUrl + locCode;

            RssReader reader = new RssReader();
            reader.Url = rssUrl;

            return reader.GetRss();
        }
    }
}
